/*
 * ODO: Real-Time In-Memory ORM/DBMS Grid software
 * Copyright (c) 2008, Michael Oksenenko
 * All rights reserved.
 */
#ifndef SHM_FACTORY_HPP
#define SHM_FACTORY_HPP

#include "OsConfig.hpp"

#include "OsComponentFactoryIF.hpp"
#include "ShmIF.hpp"
#include "ShmLinux.hpp"
#include "ShmVista.hpp"

#include <memory>

namespace odo {

template<unsigned OS>
class ShmFactory : public OsComponentFactoryIF<ShmIF> {

public: // iface

	virtual std::auto_ptr<ShmIF> getComponent() = 0;

public: // factory

	virtual ~ShmFactory() { /* void */ }

};

//============================================================================
#if ODO_OS_LINUX == ODO_CHOSEN_OS
//----------------------------------------------------------------------------
template<>
class ShmFactory<ODO_OS_LINUX> : public OsComponentFactoryIF<ShmIF> {

public: // iface

	virtual std::auto_ptr<ShmIF> getComponent() {
		return std::auto_ptr<ShmIF>(new ShmLinux());
	}

public: // factory

	virtual ~ShmFactory() { /* void */ }
	ShmFactory() { /* void */ }

};
//----------------------------------------------------------------------------
#endif /* ODO_OS_LINUX */
//============================================================================
#if ODO_OS_VISTA == ODO_CHOSEN_OS
//----------------------------------------------------------------------------
template<>
class ShmFactory<ODO_OS_VISTA> : public OsComponentFactoryIF<ShmIF> {

public: // iface

	virtual std::auto_ptr<ShmIF> getComponent() {
		return std::auto_ptr<ShmIF>(new ShmVista());
	}

public: // factory

	virtual ~ShmFactory() { /* void */ }
	ShmFactory() { /* void */ }

};
//----------------------------------------------------------------------------
#endif /* ODO_OS_VISTA */
//============================================================================

}

#endif /* SHM_FACTORY_HPP */
